package day11;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class Demo2 {
    public static void main(String[] args) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(new Date());
        int day = cal.get(Calendar.DAY_OF_MONTH);
        System.out.println(day);
        int week = cal.get(Calendar.DAY_OF_WEEK);
        System.out.println(week);
        int yearCount = cal.get(Calendar.DAY_OF_YEAR);
        System.out.println(yearCount);

        //日历对象运算
        cal.add(Calendar.DAY_OF_YEAR, 10);
        cal.add(Calendar.WEEK_OF_YEAR, 1);
        //System.out.println(cal);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        System.out.println(sdf.format(cal.getTime()));
    }
}
